package com.chinatelecom.ifree.business.dao.order.impl;

import java.sql.PreparedStatement;
import java.sql.ResultSet;

import org.springframework.stereotype.Repository;

import com.chinatelecom.ifree.business.dao.order.FileEntityDao;
import com.chinatelecom.ifree.business.domain.order.FileEntity;

@Repository
public class FileEntityDaoImpl extends BaseDaoSupport<FileEntity> implements FileEntityDao {

	@Override
	public void saveFileEntity(FileEntity entity) throws Exception {
		sql = "INSERT INTO file_info(BATCH_ID,FILE_NAME,TOTAL_RECORD,TOTAL_HANDLE,TOTAL_SUCC,TOTAL_FAIL,OPERATOR,CREATE_TIME) VALUES(?,?,?,?,?,?,?,?)";
		super.saveEntity(entity);
	}

	@Override
	public FileEntity executeSingleResultSet(ResultSet rs) throws Exception {
		return null;
	}

	@Override
	public void executeSql(PreparedStatement state, FileEntity entity) throws Exception {
		state.setString(1, entity.getBatchId());
		state.setString(2, entity.getFileName());
		state.setLong(3, entity.getTotalRecord());
		state.setLong(4, entity.getTotalHanldRecord());
		state.setLong(5, entity.getTotalSuccRecord());
		state.setLong(6, entity.getTotalFailRecord());
		state.setString(7, entity.getOperator());
		state.setTimestamp(8, entity.getCreateTime());
	}

	@Override
	public void executeBatchSql(PreparedStatement state, FileEntity[] t) throws Exception {
	}
}
